<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of UserController
 *
 * @author jianfeng
 */
class UserController extends CController {

    //put your code here
    public function actionIndex() {
        
    }

    public function actionLogin() {
        
    }

    public function actionRegister() {
        
    }

    public function actionLogout() {
        
    }

    public function actionOperation($operationId = NULL) {
        if (isset($_REQUEST['opId']))
            $operationId = $_REQUEST['opId'];
        if (isset($_REQUEST['operationId']))
            $operationId = $_REQUEST['operationId'];
        
        $yiiUser = yii::app()->user;
        
        

        if ($operationId == NULL) {
            
        }

        if ($operationId != NULL && $operationId > 0) {
            $operation = new BOperation($operationId);
            $spaceId = $operation->spaceId;
            $appId = $operation->appId;
            $space = new BSpace($spaceId);
            $app = BApp::getAppById($appId);

            Blyn::app()->setActiveSpace($space);
            Blyn::app()->setActiveApp($app);
            Blyn::app()->setActiveOperation($operation);

            $app->run();
            $operation->run();
        }
    }

}
